Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

entproto: Add proto3 optional label support #605

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

TBXark
Copy link

@TBXark TBXark commented Nov 10, 2024

proto3 supports using optional fields to define optional fields, so google/protobuf/wrappers.proto does not need to be used. This will make the generated code more concise.

The EnableOptionLabel can enable this feature for a specific Message individually.

// EnableOptionalLabel enables the optional label in the generated protobuf message instead of google/protobuf/wrappers.proto
func EnableOptionalLabel() MessageOption {
	return func(msg *message) {
		msg.EnableOptionalLabel = true
	}
}

@TBXark TBXark changed the title feat: Add proto3 optional label support entproto: Add proto3 optional label support Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant